package com.slofzx.nuoda.evaluation.project.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;

/**
 * 项目类型枚举
 * @author sunfuyong
 */
@EnumConfig(id="project-type",name = "项目类型")
public enum ProjectTypeEnum implements Type {
    WATER_DRIVE("water_drive","长垣水驱",1),
    PERIPHERAL_CONVENTIONAL_VERTICAL_WELL("peripheral_conventional_vertical_well","外围常规直井",2),
    PERIPHERAL_CONVENTIONAL_HORIZONTAL_WELL("peripheral_conventional_horizontal_well","外围常规水平井",3),
    POLYMER_DRIVE_NEW_WELL("polymer_drive_new_well","聚驱新钻井",4),
    COMPOSITE_DRIVE_NEW_WELL("composite_drive_new_well","复合驱新钻井",5),
    DOUBLE_UP_DOWN_RETURN("double_up_down_return","二次上下返",6),
    TIGHT_OIL_HORIZONTAL_WELL("tight_oil_horizontal_well","致密油水平井",7),
    TIGHT_OIL_VERTICAL_WELL("tight_oil_vertical_well","致密油直井",8),
    ;
    /**
     * 数据类型id
     */
    private String id;
    /**
     * 数据类型展示名称
     */
    private String name;
    /**
     * 排序值
     */
    private double sort;

    ProjectTypeEnum(String id, String name,double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    @Override
    public String getId() {
        return id;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public double getSort() {
        return sort;
    }

    /**
     * 根据id获取对应的枚举
     * @param id 枚举值的标识
     * @return
     */
    public static ProjectTypeEnum getEnum(String id){
        for(ProjectTypeEnum dataTypeEnum:ProjectTypeEnum.values()){
            if(dataTypeEnum.getId().equals(id)){
                return dataTypeEnum;
            }
        }
        return null;
    }

    public static ProjectTypeEnum getEnumByName(String name){
        for(ProjectTypeEnum dataTypeEnum:ProjectTypeEnum.values()){
            if(dataTypeEnum.getName().equals(name)){
                return dataTypeEnum;
            }
        }
        return null;
    }

}
